<?php

/**
 * AVE.cms - Модуль Вопрос-Ответ
 *
 * @package AVE.cms
 * @subpackage module_FAQ
 * @filesource
 */

/**
 * mySQL-запросы для установки, обновления и удаления модуля
 */

$module_sql_install = array();
$module_sql_deinstall = array();
$module_sql_update = array();

$module_sql_deinstall[] = "DROP TABLE IF EXISTS CPPREFIX_module_faq;";
$module_sql_deinstall[] = "DROP TABLE IF EXISTS CPPREFIX_module_faq_quest;";

$module_sql_install[] = "CREATE TABLE CPPREFIX_module_faq (
  `id` mediumint(5) unsigned NOT NULL auto_increment,
  `faq_title` char(100) NOT NULL default '',
  `faq_description` char(255) NOT NULL default '',
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=cp1251;";

$module_sql_install[] = "CREATE TABLE CPPREFIX_module_faq_quest (
  `id` mediumint(5) unsigned NOT NULL auto_increment,
  `faq_id` mediumint(5) unsigned NOT NULL default '1',
  `faq_quest` text NOT NULL,
  `faq_answer` text NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=cp1251;";

$module_sql_update[] = "
  UPDATE
    `CPPREFIX_module`
  SET
    ModuleAveTag = '" . $modul['ModuleAveTag'] . "',
    ModulePHPTag = '" . $modul['ModulePHPTag'] . "',
    ModuleVersion = '" . $modul['ModuleVersion'] . "'
  WHERE
    ModuleSysName = '" . $modul['ModuleSysName'] . "'
  LIMIT 1;
";

$module_sql_update[] = "
  RENAME TABLE
    `CPPREFIX_modul_faq`
  TO
    `CPPREFIX_module_faq`
";

$module_sql_update[] = "
  RENAME TABLE
    `CPPREFIX_modul_faq_quest`
  TO
    `CPPREFIX_module_faq_quest`
";
?>